A conventional video codec (compressor/decompressor) includes both an encoder and a decoder. The encoder compresses video signals, and the decoder decompresses video signals. Codecs typically perform compression and decompression on “blocks” of video “frames,” where each block is a two-dimensional array of pixels, such as 8×8 pixels or 16×16 pixels, for example, and each frame corresponds to a still snapshot of the video signal. Well-known video codecs include those conforming to H.264 or H.265 standards.
Codecs typically achieve efficient compression by taking advantage of predictions. For example, an encoder may employ intra-frame predictions, which apply information from previously-processed blocks in the same frame as a current block to predict pixels in the current block. An encoder may also employ inter-frame predictions, which apply information from previously-processed frames to predict pixels in the current block. For each current block to be encoded, the encoder selects a prediction mode and generates a prediction. The encoder then subtracts the prediction, pixel-by-pixel, from the current block to generate a residual block. If the current prediction closely matches the current block, then the residual block generally requires less data to encode than would be required for the current block without prediction. The encoder may next perform a lossless, 2-dimensional Discrete Cosine Transform, or “DCT,” on the residual block. The DCT transforms pixel data in the spatial domain into coefficients in the frequency domain. The encoder subjects the DCT coefficients to a lossy quantization process, whereby DCT coefficients are scaled and rounded and/or truncated, to reduce their granularity and to increase the number of coefficients that equal zero. Zero-valued coefficients are highly compressible and are thus preferred where high compression ratios are desired. The encoder typically performs lossless entropy encoding on the quantized DCT coefficients and stores the results and/or transmits them to a decoder, e.g., at another location, along with an identifier of the prediction mode that the encoder used in compressing the current block.
The decoder performs essentially the reverse process. For example, the decoder, upon receiving a compressed block, reverses the entropy encoding, descales the entropy-decoded results, and performs an inverse-DCT operation (IDCT) to reconstruct the residual block. The decoder also reads the prediction mode received from the encoder and replicates the same prediction locally, i.e., using previously decoded blocks. The decoder then adds the replicated prediction to the residual block to reconstruct the original block, albeit with losses introduced by encoder quantization. The decoder assembles the reconstructed original block along with other reconstructed blocks to generate frames of video data for viewing on a user device, such as a computer, television, smart phone, tablet, or the like.